package com.cg.config;

import com.cg.entity.CheEntity;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(CheProperties.class)
public class CheAutoConfiguration {

    private CheProperties cheProperties;

    public CheAutoConfiguration(CheProperties cheProperties){
        this.cheProperties = cheProperties;
    }

    @Bean
    public CheEntity cheEntity() {
        return new CheEntity(cheProperties.getName(), cheProperties.getAge());
    }


}
